package com.wjv.example.spbt.es.controller;

import org.elasticsearch.client.IndicesClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>Title: HelloController</p>
 *
 * @author wjv
 * @since 2022/1/25 18:14
 */
@RestController
@RequestMapping(path = "hello")
public class HelloController {


    @Autowired
    RestHighLevelClient restHighLevelClient;

    @GetMapping(path = "/hello")
    public String hello() {
        return "hello, elasticsearch";
    }

    @GetMapping(path = "/index")
    public String index() {

        IndicesClient indices = restHighLevelClient.indices();

        return restHighLevelClient.toString();
    }
}
